@charset "UTF-8";
@import "common/var";
@import "mixins/button";
@import "mixins/mixins";
@import "mixins/utils";

@mixin box-color($color) {
  //默认dark
  @include box-dark($color);



  &.is-dark {
    @include box-dark($color);
  }

  &.is-light {
    @include box-light($color);
  }

  &.is-plain {
    @include box-plain($color);
  }


  /*&:active {
    background: mix($color-black, $color, $percent-active);
    border-color: mix($color-black, $color, $percent-active);
    color: $color;
    outline: none;
  }*/

  /*&.is-active {
    background: mix($color-black, $color, $percent-active);
    border-color: mix($color-black, $color, $percent-active);
    color: $color;
  }*/

  /*&.is-disabled {
    &,
    &:active {
      color: $color-white;
      background-color: mix($color, $color-white);
      border-color: mix($color, $color-white);
    }
  }*/

  /*

  */
}

//白色不区分 主题类，始终同一配色
.box-white {
  color: $color-font-default;
  background-color: $color-default;
  border-color: $color-border-default;
}

//默认dark
@mixin box-dark($color) {
  //如果为白色
  @if $color == $color-white {
    @extend .box-white;
  } @else {
    //深色主题，字体白色，其他主题色
    color: $color-white;
    background-color: $color;
    border-color: $color;
  }
}

//朴素盒子
@mixin box-plain($color) {
  //如果为白色
  @if $color == $color-white {
    @extend .box-white;
  } @else {
    //深色主题，背景白色，其他主题色
    color: $color;
    background-color: $color-white;
    border-color: $color;
  }
}

//亮色盒子
@mixin box-light($color) {
  //如果为白色
  @if $color == $color-white {
    @extend .box-white;
  } @else {
    //深色主题，背景白色，其他主题色
    color: $color;
    background: mix($color-white, $color, 90%);
    border-color: mix($color-white, $color, 60%);
  }
}


@mixin button-light($color) {
  color: $color;
  background: mix($color-white, $color, 90%);
  border-color: mix($color-white, $color, 60%);

  /* &:active {
     background: mix($color-black, $color, $percent-active);
     border-color: mix($color-black, $color, $percent-active);
     color: $color-white;
     outline: none;
   }

   &.is-disabled {
     &,
     &:active {
       color: mix($color-white, $color, 40%);
       background-color: mix($color-white, $color, 90%);
       border-color: mix($color-white, $color, 80%);
     }
   }*/
}


//盒子浅色
@mixin box-light($color) {
  @if $color == $color-white {
    color: $color-font-theme;
    border-color: $color-border-default;
  } @else {
    color: $color-white;
    border-color: $color;
  }
  color: $color;
  background: mix($color-white, $color, $percent-light-bg);
  border-color: mix($color-white, $color, $percent-light-border);
}

@mixin button-plain($color) {
  @if $color == $color-white {
    color: $color-font-default;
    border-color: $color-border-default;
  } @else {
    color: $color;
    border-color: $color;
  }
  background: $color-white;
  /*&:active {
    @include button-light($color);
  }*/

  &.is-disabled {
    &,
    &:active {
      color: mix($color-white, $color, 40%);
      background-color: mix($color-white, $color, 90%);
      border-color: mix($color-white, $color, 80%);
    }
  }
}


@mixin button-size($size) {
  //$size = df
  padding: map-get($box-map, box-#{$size});
  font-size: map-get($font-map, font-#{$size});
  //padding: $space-x-df;
}


@each $key, $val in $colors {
  .bg-#{$key} {
    @include box-color($val);
  }
}

@each $key, $val in $box-map {
  .bg-#{$key} {
    @include box-color($val);
  }
}

@include b(button) {
  display: inline-block;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;

  border: $border-base;

  -webkit-appearance: none;
  text-align: center;
  box-sizing: border-box;
  outline: none;
  margin: 0;
  transition: .1s;
  font-weight: $--button-font-weight;
  @include utils-user-select(none);
  & + & {
    margin-left: 10px;
  }
  //取消uni默认的边框
  &:after {
    border: none;
  }

  @extend .bg-default;

  //默认为默认颜色朴素按钮
  //@include button-color($color-default);

  @each $key, $val in $colors {
    @include m($key) {
      @extend .bg-#{$key};
    }
  }

  @include m(df) {
    @include button-size(df);
  }
}

/*
默认情况下的，需要什么样，
用了主题、
用了light
用了plain*/

